#ifndef SWEEPSURF_H_
#define SWEEPSURF_H_

#include <GL/glew.h>
#include <GL/glut.h>
#include <glm/glm.hpp>

#include <math.h>
#include <iostream>
#include <vector>
#include "Figure.h"

#include "BezierCuadCurve.h"
#include "BSplineCuadCurve.h"
#define DETAILNORMALSSWEEPSURF 2

using std::vector;
class SweepSurf : public Figure{
	public:
		virtual ~SweepSurf();
		SweepSurf(GLuint program, vector<float>* Points,vector<float>* PathPoints);
		void drawSurface(glm::mat4 mat);
		void drawCurve(glm::mat4 mat);
		void drawPath(glm::mat4 mat);
		void drawNormals(glm::mat4);
		void drawControlPoints();
		virtual void draw(GLuint program, glm::mat4 & world_matrix);
		void translateCtrlPoints(float x, float y, float z);

	private:
		vector<float>* controlPoints;
		vector<float>* originalControlPoints;
		vector<float>* surface;
		vector<float>* normals;
		vector<float>* path;
		float vectorPerp[3];
		float delta[3];

		size_t largoCurva;

		void rotateCtrlPoints(float angle);
		void rotateCtrlPointsFromOriginal(float angle);
		float calcularAngulo(float dx,float dy,float dz,float dx2,float dy2,float dz2);

		void createSurface();
		vector<float>* translate();
		glm::vec4 transform(glm::mat4 transfMat,float x, float y, float z);
		glm::mat4 rotate(float angle);
		void createVertex(void);
};

#endif
